<!-- doAdminLogin.php 用于判断用户是否合法。 -->
<?php
  header("content-type:text/html;charset=utf-8");
  session_start();
  require('../Model/Model.php');
  require '../../common/ConnDB.php';
  require '../../common/config.php';
  //会话  作用：1.权限
  //            2.分享，传值
  //获取用户输入的信息
  $adminname = $_POST["adminname"];
  $pwd = ($_POST["pwd"]);
  class con extends Model{
    public $c;
    function __Construct(){
      parent::__Construct();
    }
  }
  $c=new con();
  //编写sql语句
  $sql = "select * from admins where adminname='".$adminname."' and password=('".$pwd."')"; 
  //var_dump($sql);
  $result = $c->fetch_one($sql);
  //判断是否合法用户，如果是合法用户，则转向用户列表页面，否则转向登录页面
  /*$num = mysql_num_rows($result);*/
  //if($num>0)
  if($result){
      $_SESSION['adminname']= $result;
      echo '登陆成功'.'<a href="../Admin.php?c=De&m=department">如果没有跳转，请点这里跳转</a>';
      header("refresh:3;../Admin.php?c=De&m=department = ../Admin.php?c=De&m=department");  
    }else{
      echo '用户名或密码错误！请重新登录！'.'<a href="login.html">如果没有跳转，请点这里跳转</a>';
      header("refresh:3;power/login.html = power/login.html");
    }
?>
